﻿using System;
using System.Globalization;
using DailyPoetryX.Models;
using DailyPoetryX.Util;
using Xamarin.Forms;

namespace DailyPoetryX.Converters {
    public class LayoutToTextAlignmentConverter : IValueConverter {
        public object Convert(object value, Type targetType, object parameter,
            CultureInfo culture) {
            switch (value as string) {
                case Poetry.CENTER_LAYOUT:
                    return TextAlignment.Center;
                case Poetry.INDENT_LAYOUT:
                    return TextAlignment.Start;
                default:
                    return null;
            }
        }

        public object ConvertBack(object value, Type targetType,
            object parameter, CultureInfo culture) {
            throw new DoNotCallThisExcpetion();
        }
    }
}